using System;
using System.Collections.Generic;
using Beaker.OpenCube.Render.Maths;

namespace Beaker.OpenCube.Render.Sampling
{
	public sealed class OrderedSampler
		: Sampler
	{
		public OrderedSampler( int sampleCount )
			: base( sampleCount )
		{
		}

		public override IEnumerable<Point2> GenerateSamplesSquare( SampleOptions options = SampleOptions.None )
		{
			int n = (int)Math.Sqrt( SampleCount );
			double offset = 1d / n;

			for( int j = 0; j < n; j++ )
				for( int k = 0; k < n; k++ )
					yield return
						new Point2(
							j * offset,
							k * offset
						);
		}
	}
}